//栈
function ArrayStack () {
  var arr = [];
  var lastOperation = ''
  //压栈操作  
  this.push = function (element) {
    lastOperation = 'push'
    arr.push(element);
  }
  //退栈操作  
  this.pop = function () {
    lastOperation = 'pop'
    let element = arr.pop()
    return element;
  }
  //获取栈顶元素  
  this.top = function () {
    return arr[arr.length - 1];
  }
  //获取栈长  
  this.size = function () {
    return arr.length;
  }
  //清空栈  
  this.clear = function () {
    arr = [];
    return true;
  }

  this.toString = function () {
    return arr.toString();
  }

  this.getLastOperation = function () {
    return lastOperation
  }
}

var handleStack = new ArrayStack()
var restoreHandleStack = new ArrayStack()
export {
  handleStack,
  restoreHandleStack
}